// 1.创建路由组件
import Vue from 'vue'
import VueRouter from 'vue-router'
// 2.引入组件
import Home from '../views/Home.vue'
import User from '../views/User.vue'
import Main from '../views/Main.vue'
import Mall from '../views/Mall.vue'
import PageOne from '../views/PageOne.vue'
import PageTwo from '../views/PageTwo.vue'


Vue.use(VueRouter)

const routes = [
    {
        path:'/',
        component: Main,
        redirect:'/home',
        children:[
            {
                path: '/home', component: Home
            },
            {
                path: '/user', component: User
            },
            {
                path: '/mall', component: Mall
            },
            {
                path: '/pageOne', component: PageOne
            },
            {
                path: '/pageTwo', component: PageTwo
            }
        ]
    },
    
    
]



const router = new VueRouter({
    routes // (缩写) 相当于 routes: routes
})


export default router